﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary.Filters.BloomFilter
{
    /// <summary>
    /// This class represents a string object for a BloomFilter.
    /// </summary>
    [Serializable]
    public class BloomFilterStringObject : IBloomFilter
    {
        /// <summary>
        /// A field, which holds the string value of the object.
        /// </summary>
        private string value;

        /// <summary>
        /// Initializes a new instance of the <see cref="BloomFilterStringObject"/> class.
        /// </summary>
        /// <param name="value">The value of the object.</param>
        public BloomFilterStringObject(string value)
        {
            this.value = value;
        }

        /// <summary>
        /// Gets or sets the value of the object.
        /// </summary>
        /// <value>The value of the object.</value>
        public string Value
        {
            get { return value; }
            set { this.value = value; }
        }

        /// <summary>
        /// Gets the hash code, which will be used by the BloomFilter.
        /// </summary>
        /// <returns>
        /// The hash code, which will be used by the BloomFilter
        /// </returns>
        public UInt64 GetBloomHashCode()
        {
            return HashFactory.OneAtATimeHash(value);
        }
    }
}